package gss.generator;

public class LogSCGen {
	public static void main(String[] args){
		double m = (double)Integer.parseInt(args[0]);
		int segnum = 0;
		int vertnum = (int)m;
		int[] groupnum = new int[(int)m+1];
		groupnum[0]=0; groupnum[1]=0;
		
		for(int i = 2; i <= m; i++){
			groupnum[i]=(int)(m/i);
			//System.out.println(groupnum[i]);
			vertnum+=groupnum[i];
			segnum+=groupnum[i]*i;
		}
		
		int[][] binarymat = new int[vertnum][segnum];
		
		for(int i = 0; i < vertnum; i++){
			for(int j = 0; j < segnum; j++){
				binarymat[i][j]=0;
			}
		}
		int start = 0;
		int current = (int)m;
		for(int i = 2; i <= m; i++){
			for(int j = 0; j < groupnum[i]; j++){
				for(int k = start; k < (start+i); k++){
					binarymat[current][k]=1;
					binarymat[k-start][k]=1;
				}
				start+=i;
				current++;
			}
		}
		
		
		for(int i = 0; i < vertnum; i++){
			for(int j = 0; j < segnum; j++){
				System.out.print(binarymat[i][j] + " ");
			}
			System.out.println();
		}
		/*int start = 0;
		int end = 2;
		for(int i = 2; i <= m; i++){
			start = 0;
			end = i;
			for(int j = 0; j < groupnum[i]; j++){
				for(int k = 0; k < segnum; k++){
					if(k >= start && k <= end){
						System.out.print(1 + " ");
					}
					else{
						System.out.println(0 + " ");
					}
				}
				System.out.println();
				start = end;
				end += i;
			}
		}*/
	}
}
